package com.java.miaosha.dao;

import com.java.miaosha.entity.MiaoshaGoodsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

/**
 * 秒杀商品表
 * 
 * @author jiangli
 * @email 31346337@qq.com
 * @date 2019-08-31 17:19:06
 */
@Mapper
public interface MiaoshaGoodsDao extends BaseMapper<MiaoshaGoodsEntity> {

	@Update("UPDATE `miaosha_goods` SET `stock_count` = `stock_count`-1 WHERE `goods_id` = #{goodsId} AND `stock_count`>0")
	int reduceStock(Long goodsId);
}
